package com.base.pig.controller;

import com.base.pig.dto.ScAnnotationDto;
import com.base.pig.util.R;
import com.base.pig.service.ScAnnotationService;

import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ProjectName intelligent-city
 * @Package com.pig4cloud.pig.lab.annotation.controller
 * @ClassName ScAnnotationController
 * @Description 标注处理
 * @Company lab
 * @Author zgq
 * @Date 2020/7/13 18:57
 * @UpdateUser
 * @UpdateDate
 * @UpdateRemark
 * @Version 1.0.0
 */
@RestController
@RequestMapping("annotation")
@AllArgsConstructor
@Api(value = "dict", tags = "标注管理")
public class ScAnnotationController {

    private ScAnnotationService scAnnotationService;

    //@SysLog("标注管理,全查列表")
    @GetMapping("selectAll")
    public R selectAll() {
        return scAnnotationService.selectAll();
    }

    /**
     * @param ids 主键id集合
     * @return
     */
    //@SysLog("删除标注")
    @PostMapping("delete")
    public R delete(@RequestBody List<Long> ids) {
        return scAnnotationService.delete(ids);
    }

    /**
     * @param scAnnotationList 标注集合
     * @return
     */
    //@SysLog("添加标注")
    @PostMapping("insert")
    public R insert(@RequestBody List<ScAnnotationDto> scAnnotationList) {
        return scAnnotationService.insertList(scAnnotationList);
    }

    /**
     * @param ids 标注id集合
     * @param state 状态
     * @return
     */
    //@SysLog("更改标注状态")
    @PostMapping("updateState/{state}")
    public R updateState(@RequestBody List<Long> ids, @PathVariable int state) {
        return scAnnotationService.updateStateByIds(ids, state);
    }
}
